package hcn.protocol.brandnew.dengji.guahao;

import com.fasterxml.jackson.annotation.JsonFormat;
import ctd.util.xml.jaxb.DateAdapter;
import ctd.util.xml.jaxb.DateTimeAdapter;
import lombok.Data;
import org.atag.sysrouter.annotation.DictionaryMapping;

import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Date;
import java.util.List;


/**
 * 门诊挂号信息查询-响应消息（成功） - ODS_02030003_SUC
 *
 * @author enjoyLife
 */
@Data
@XmlRootElement(name = "Data")
@XmlAccessorType(XmlAccessType.FIELD)
public class GetMedicalregisterInfoResponse {

    /**
     * 总条数
     */
    @XmlElement(name = "Total")
    private String total;
    /**
     * 挂号记录数集合
     */
    @XmlElementWrapper(name = "Records")
    @XmlElement(name = "Record")
    private List<Record> records;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Patient {

        /**
         * 业务系统患者档案ID
         */
        @XmlElement(name = "SourcePatientId")
        private String sourcePatientId;
        /**
         * 业务系统患者档案类型
         */
        @XmlElement(name = "SourcePatientIdType")
        private String sourcePatientIdType;
        /**
         * 建档机构代码
         */
        @XmlElement(name = "AuthorOrganization")
        private String authorOrganization;
        /**
         * 患者姓名
         */
        @XmlElement(name = "Name")
        private String name;
        /**
         * 身份证件号码
         */
        @XmlElement(name = "IdCard")
        private String idCard;
        /**
         * 性别代码
         */
        @XmlElement(name = "Sex")
        private String sex;
        /**
         * 出生日期
         */
        @XmlElement(name = "BirthDate")
        @XmlJavaTypeAdapter(DateAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
        private Date birthDate;
        /**
         * 身份证件类别代码
         */
        @XmlElement(name = "IdCardCode")
        private String idCardCode;
        /**
         * 电话号码
         */
        @XmlElement(name = "PatientPhone")
        private String patientPhone;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class MedicalInsuranceCost {

        /**
         * 医保支付金额
         */
        @XmlElement(name = "MedicalInsuranceCost")
        private String medicalInsuranceCost;
        /**
         * 医保支付方式
         */
        @XmlElement(name = "MedicalInsuranceCostTypeCode")
        private Byte medicalInsuranceCostTypeCode;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class OptRegister {

        /**
         * 就诊医疗机构组织机构代码
         */
        @XmlElement(name = "VisitOrganization")
        private String visitOrganization;
        /**
         * 就诊机构名称
         */
        @XmlElement(name = "VisitOrganizationName")
        private String visitOrganizationName;
        /**
         * 挂号流水号
         */
        @XmlElement(name = "OutRegistryId")
        private String outRegistryId;
        /**
         * 门（急）诊号
         */
        @XmlElement(name = "ClinicId")
        private String clinicId;
        /**
         * 就诊次数
         */
        @XmlElement(name = "VisitTimes")
        private Short visitTimes;
        /**
         * 患者类型代码
         */
        @XmlElement(name = "PatientType")
        private String patientType;
        /**
         * 就诊卡号
         */
        @XmlElement(name = "MedicalCardId")
        private String medicalCardId;
        /**
         * 就诊卡类别代码
         */
        @XmlElement(name = "MedicalCardType")
        private String medicalCardType;
        /**
         * 挂号科室代码
         */
        @XmlElement(name = "RegisteredDept")
        private String registeredDept;
        /**
         * 挂号科室名称
         */
        @XmlElement(name = "RegisteredDeptName")
        private String registeredDeptName;
        /**
         * 挂号医师代码
         */
        @XmlElement(name = "RegisteredDcotor")
        private String registeredDcotor;
        /**
         * 医生姓名
         */
        @XmlElement(name = "RegisteredDcotorName")
        private String registeredDcotorName;
        /**
         * 挂号类别代码
         */
        @XmlElement(name = "RegisteredType")
        private String registeredType;
        /**
         * 医师排班类别代码
         */
        @DictionaryMapping("hcn.base.dictionary.HCN_outpatientSchedulingService")
        @XmlElement(name = "DoctorDutyType")
        private String doctorDutyType;
        /**
         * 挂号日期时间
         */
        @XmlElement(name = "RegisteredDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date registeredDateTime;
        /**
         * 患者性质代码
         */
        @XmlElement(name = "PatientProperties")
        private String patientProperties;
        /**
         * 挂号顺序号
         */
        @XmlElement(name = "RegisteredSequence")
        private String registeredSequence;
        /**
         * 挂号单据号
         */
        @XmlElement(name = "RegisteredNo")
        private String registeredNo;
        /**
         * 诊查费
         */
        @XmlElement(name = "ExaminationCost")
        private String examinationCost;
        /**
         * 挂号费
         */
        @XmlElement(name = "RegisteredCost")
        private String registeredCost;
        /**
         * 专家费
         */
        @XmlElement(name = "DoctorCost")
        private String doctorCost;
        /**
         * 病历本费
         */
        @XmlElement(name = "BookCost")
        private String bookCost;
        /**
         * 就诊卡费
         */
        @XmlElement(name = "CardCost")
        private String cardCost;
        /**
         * 排班日期时间
         */
        @XmlElement(name = "ScheduleDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date scheduleDateTime;
        /**
         * 分时段开始时间
         */
        @XmlElement(name = "DaypartingBeginDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date daypartingBeginDateTime;
        /**
         * 分时段结束时间
         */
        @XmlElement(name = "DaypartingEndDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date daypartingEndDateTime;
        /**
         * 就诊地址
         */
        @XmlElement(name = "AdmitAddress")
        private String admitAddress;
        /**
         * 预约标志
         */
        @XmlElement(name = "IsAppoints")
        private String isAppoints;
        /**
         * 预约途径代码
         */
        @XmlElement(name = "AppointsRoute")
        private String appointsRoute;
        /**
         * 预约记录流水号
         */
        @XmlElement(name = "AppointsId")
        private String appointsId;
        /**
         * 挂号操作人
         */
        @XmlElement(name = "RegisterOperator")
        private String registerOperator;
        /**
         * 挂号状态代码
         */
        @DictionaryMapping(id = "visitStatus")
        @XmlElement(name = "VisitStatus")
        private String visitStatus;
        /**
         * 退号标志
         */
        @XmlElement(name = "IsCancelRegister")
        private String isCancelRegister;
        /**
         * 取号时间
         */
        @XmlElement(name = "RegisterTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date registerTime;
        /**
         * 退号操作人
         */
        @XmlElement(name = "CancelOperator")
        private String cancelOperator;
        /**
         * 退号时间
         */
        @XmlElement(name = "CancelDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date cancelDateTime;
        /**
         * (退号)门诊类别代码
         */
        @XmlElement(name = "CancelOptType")
        private String cancelOptType;
        /**
         * 总计金额
         */
        @XmlElement(name = "TotalCost")
        private String totalCost;
        /**
         * 自负金额
         */
        @XmlElement(name = "SelfCost")
        private String selfCost;
        /**
         * 医保支付方式集合
         */
        @XmlElementWrapper(name = "MedicalInsuranceCosts")
        @XmlElement(name = "MedicalInsuranceCost")
        private List<MedicalInsuranceCost> medicalInsuranceCosts;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Record {

        /**
         * 患者基本信息
         */
        @XmlElement(name = "Patient")
        private Patient patient;
        /**
         * 门（急）诊挂号记录
         */
        @XmlElement(name = "OptRegister")
        private OptRegister optRegister;
    }

}
